import javax.swing.*;
import javax.swing.event.*;
import java.awt.*;
import java.awt.event.*;
/**
This class demonstrates the basics of setting up a Java Swing GUI using the
BorderLayout. You should be able to use this program to drop in other
components when building a GUI
*/
public class BasicGui{
// Initialize all swing objects.
private JFrame f = new JFrame("Event Maker"); //create Frame
private JPanel HomePanel = new JPanel(); // North quadrant
private JPanel CreateEvent = new JPanel();
private JTextField ETitle;
private JTextField ELocation;
private JTextField EComments;

// Buttons some there is something to put in the panels
private JButton newEventBtn = new JButton("New Blank Event");


// Menu
private JMenuBar mb = new JMenuBar(); // Menubar
private JMenu mnuFile = new JMenu("File"); // File Entry on Menu bar
private JMenuItem mnuItemQuit = new JMenuItem("Quit"); // Quit sub item
private JMenu mnuHelp = new JMenu("Help"); // Help Menu entry
private JMenuItem mnuItemAbout = new JMenuItem("About"); // About Entry

/** Constructor for the GUI */
public BasicGui(){
// Set menubar
f.setJMenuBar(mb);

//Build Menus
mnuFile.add(mnuItemQuit); // Create Quit line
mnuHelp.add(mnuItemAbout); // Create About line
mb.add(mnuFile); // Add Menu items to form
mb.add(mnuHelp);

// HomePanel to navigate
HomePanel.add(newEventBtn);


//CreateEvent panel to create calendar event
CreateEvent.add(new JLabel("Event Title:"));

// Setup Main Frame
f.getContentPane().setLayout(new BorderLayout());
f.getContentPane().add(HomePanel, BorderLayout.NORTH);
f.setSize(500, 300);

// Allows the Swing App to be closed
f.addWindowListener(new ListenCloseWdw());

//Add Menu listener
mnuItemQuit.addActionListener(new ListenMenuQuit());
}

public class ListenMenuQuit implements ActionListener{
public void actionPerformed(ActionEvent e){
System.exit(0);
}
}

public class ListenCloseWdw extends WindowAdapter{
public void windowClosing(WindowEvent e){
System.exit(0);
}
}

public void launchFrame(){
// Display Frame
f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
f.setVisible(true);
}

public static void main(String args[]){
BasicGui gui = new BasicGui();
gui.launchFrame();
}
}